package com.cos.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author: COS
 * @time: 2021/5/19 14:16
 * @description:
 *     在controller上不写requestMapping()路径就是默认的/
 */
@Controller
public class Demo2Controller {

    @RequestMapping("/test1")
    public String d1(){
        System.out.println("已经访问test1,接下来进行转发");
        // 转发到demo.jsp
//        return "forward:/demo.jsp";
        return "forward:/test2";
    }

    @RequestMapping("/test2")
    public String d2(){
        System.out.println("这里是test2,返回逻辑视图名");
        return "demo";
    }
    @RequestMapping("/test3")
    public String d3(){
        System.out.println("这里是test3");
        //增删改
        return "redirect:/addUser.jsp";
    }

}
